class window.Entity
  boffx : ->
    0
  boffy : ->
    0

  bwidth : ->
    64

  bheight : ->
    64



  die : () ->

  isDead : () ->
    return @health <= 0

  rest : () ->
    @stammina += @recovery
    @stammina = @maxStammina if @stammina > @maxStammina
  
  canRun : () ->
    return @stammina >= 0
  
  hurt : (hp) ->
    @health -= hp

    console.log "Hurt! " + hp

    if @health <= 0
      @die()

  addTag : (tag) ->
    @tags[tag] = true
  
  removeTag : (tag) ->
    @tags[tag] = false
  
  hasTag : (tag) ->
    return @tags[tag] == true

  hasStammina : (a) ->
    if a > @stammina
      return false

    @stammina -= a
    return true

  init : (@g) ->
    @isRemoved = false
    @x = 0
    @y = 0
    @isCarrying = null
    @id = Math.random()
    @tags = {}
    @stammina = @maxStammina = 100
    @health = @maxHealth = 100
    @runningCost = 0.5
    @recovery = 0.25
    @transform = new window.Transform2D()
    @transform.setScale 4, 4
    @height = 64
    @strength = 20.0

  update : ->
  render : ->

  renderBBox : ->
    ox = @g.vx
    oy = @g.vy
    sp = @g.shapeRender

    x0 = @x + @boffx() + ox
    y0 = @y + @boffy() + oy
    x1 = x0 + @bwidth()
    y1 = y0 + @bheight()

    @g.shapeRender.drawRectFilled x0, y0, x1, y1, 1.0, 0.0, 0.0, 0.25



  slideCollide : (info) ->

  collidedWith : (who) ->